<template>
	<view>
		<view class="cu-card dynamic" v-for="(item,index) in productList" :key="index" @click="toProductList(item.workid)">
			<view class="cu-item shadow">
				<view class="cu-list menu-avatar">
					<view class="cu-item">
						<view class="cu-avatar round lg" style="background-image:url()">
						</view>
						<view class="content flex-sub">
							<view>{{item.coursename}}</view>
						</view>
					</view>
				</view>
				<view class="text-content">
					开始时间： {{item.firsttime}}
				</view>
				<view class="text-content">
					结束时间： {{item.endtime}}
				</view>
				<!--课程状态>
                <view class="text-gray text-sm text-right padding">
                    <text class="cuIcon-attentionfill margin-lr-xs"></text> {{item.stats}}
                </view-->
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				isCard: false,
				courseid: '',
				productList: {},
			};
		},
		onLoad: function(op) {
			if (op) {
				console.log(op.courseid);
				this.courseid = op.courseid;
			}
		},
		onReady() {
			this.getwork();
		},
		methods: {
			getwork() {
				this.$http('/stuwork', {
						courseid: this.courseid
					})
					.then((res) => {
						console.log(res);
						this.productList = res;
					})
			},
			toProductList(workid) {
				uni.navigateTo({
					url: "./dowork?workid=" + workid,
				})
			}
		}
	}
</script>
<style>
	@import url("../../colorui/icon");
	@import url("../../colorui/animation");
	@import url("../../colorui/main");

	.flex-sub {
		margin-left: 1px;
	}

	.cu-card.dynamic>.cu-item>.text-content {
		margin-bottom: 1px;
		margin-top: 6px;
	}
</style>
